<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    
</body>
<script>

    var obj = {
        name:"admin",
        age:18,
        sex:"男",
        hobby:"唱"
    }

    // 当要读取的属性是一个具体的值时

    // obj.job = "程序员";
    // obj.name = "张三";

    // obj.age = undefined;

    // delete obj.sex;

    // console.log(obj.name);
    // console.log(obj.age);
    // console.log(obj.sex);
    // console.log(obj.hobby);
    // console.log(obj)

    // 当要读取的属性被存储在一个变量中时

    var key = "hobby";
    console.log( obj[key] );

    obj["job"] = "项目经理";

    var k = "height";

    obj[k] = "185";

    delete obj[key];

    console.log( obj["name"] )
    console.log( obj["age"] )
    console.log( obj["sex"] )
    console.log( obj["hobby"] )
    console.log( obj["key"] )

    console.log( obj );




    
</script>
</html>